import { defHttp } from '/@/common/util/axios';
import { Modal } from 'ant-design-vue';

enum Api {
  list = '/test/demo/getPage',
  save = '/test/demo/add',
  edit = '/test/demo/edit',
  get = '/test/demo/getId',
  deleteOne = '/test/demo/delete',
  updateBatch = '/test/demo/updateBatch',
  deleteBatch = '/test/demo/deleteBatch',
  exportXls = '/test/demo/exportXls',
  importExcel = '/test/demo/importExcel',
  getTenantById = '/test/demo/getTenantById',   //测试feign
  getUrlMsg = '/test/demo/getUrlMsg',           //测试feign-三方url
  getDate = '/test/demo/getDate',               //测试日期格式
}

/**
 * 导出导入api
 * @param params
 */
export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel;
/**
 * 增删改查接口
 */
export const getDemoById = (params) => defHttp.get({ url: Api.get, params });

export const list = (params) => defHttp.get({ url: Api.list, params });
export const saveOrUpdate = (params, isUpdate) => defHttp.post({ url: isUpdate ? Api.edit : Api.save, params });
export const deleteOne = (params) => defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true });
export const updateBatch = (params) => defHttp.post({ url: Api.updateBatch, params });
export const deleteBatch = (params) => defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true });

export const getTenantById = (params) => defHttp.get({ url: Api.getTenantById, params });
export const getUrlMsg = (params) => defHttp.get({ url: Api.getUrlMsg, params });
export const getDate = (params) => defHttp.get({ url: Api.getDate, params });


